package GA;

import java.lang.reflect.Array;
import java.lang.reflect.Method;

public class Demo {

    public static void main(String[] args) throws Exception{
        Class[] parameterTypes = new Class[1];
        parameterTypes[0] = String.class;
        Method method1 = Demo.class.getMethod("method1", parameterTypes);
        
        Method m = Demo.class.getMethods()[3];
        Class pa = m.getParameterTypes()[0];
        Class ty = pa.getComponentType();
        Class a = Integer.class;
        Integer[] arr = (Integer[]) Array.newInstance(Integer.class, 0);
        Integer[][] arrr = (Integer[][]) Array.newInstance(arr.getClass(), 0);
        System.out.println("method: " + m.getName() + "# " + m.getParameterTypes()[0].getClass().equals(arrr.getClass()));
        Demo demo = new Demo();
        demo.method2(demo, method1, "Hello World");
    }

    public void method1(String message) {
        System.out.println(message);
    }

    public void method2(Object object, Method method, String message) throws Exception {
        Object[] parameters = new Object[1];
        parameters[0] = message;
        method.invoke(object, parameters);
    }
    
    public void method3(Integer[][] test)
    {
    	
    }

}
